package org.hdax.dm.controller;

import lombok.AllArgsConstructor;
import org.hdax.dm.entity.item_type.DmItemType;
import org.hdax.dm.request.QueryItemLike;
import org.hdax.dm.request.QueryItemListRequest;
import org.hdax.dm.request.QueryItemTypeRequest;
import org.hdax.dm.response.CommonPageRespone;
import org.hdax.dm.service.DmCinemaService;
import org.hdax.dm.service.DmItemService;
import org.hdax.dm.service.DmItemTypeService;
import org.hdax.dm.vo.CommonResponse;
import org.hdax.dm.vo.entity.cinema.VoCinema;
import org.hdax.dm.vo.entity.item.VoQueryItemLike;
import org.hdax.dm.vo.entity.item_type.VoDmItemType;
import org.hdax.dm.vo.entity.item_type.VoDmItemTypethree;
import org.hdax.dm.vo.es.item.VoEsDmItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping
public class ProductListConstoller {
    @Autowired
    private DmItemService dmItemService;

    @Autowired
    private DmCinemaService dmCinemaService;

    @Autowired
    private DmItemTypeService dmItemTypeService;

    @PostMapping(path = "/p/list/queryItemList")
    @ResponseBody
    public CommonResponse<CommonPageRespone<List<VoEsDmItem>>> queryItemList(@RequestBody QueryItemListRequest queryItemListRequest) {
        return dmItemService.queryItemList(queryItemListRequest);
    }

    @PostMapping(path = "/p/area/queryCityList")
    @ResponseBody
    public CommonResponse<List<VoCinema>> queryCityList() {
        return dmCinemaService.queryCityList();
    }

    @PostMapping(path = "/p/type/queryItemType")
    @ResponseBody
    public CommonResponse<List<VoDmItemTypethree>> queryItemType(@RequestBody QueryItemTypeRequest queryItemTypeRequest) {
        return dmItemTypeService.queryItemType(queryItemTypeRequest.getParent());
    }


    @PostMapping(path = "/p/queryItemLike")
    @ResponseBody
    public CommonResponse<List<VoQueryItemLike>> queryItemLike(@RequestBody QueryItemLike queryItemLike) {
        return dmItemService.queryItemLike(queryItemLike);
    }
}
